// import { computed } from "vue";
// import { useStore } from "vuex";
// import { Computed, Mapper, MapperWithNamespace, createNamespacedHelpers, mapState, mapGetters, mapActions, mapMutations } from "vuex";
// function useMapper(mapper: Array<string>, mapName: string, mapFn: Mapper<Computed> & MapperWithNamespace<Computed>) {
//     const store = useStore();
//     const storeStateFns = mapFn(mapper as unknown as Record<string, string>);
//     const storeState: any = {};
//     Object.keys(storeStateFns).forEach((fnKey) => {
//         const fn = storeStateFns[fnKey].bind({ $store: store });
//         if ((mapName && mapName === 'mapMutations') || mapName === 'mapActions') {
//             // storeState[fnKey] = fn
//             storeState[fnKey as keyof typeof mapFn] = computed(() => {
//                 return fn
//             }).value
//         } else {
//             storeState[fnKey as keyof typeof mapFn] = computed(fn).value
//         }
//     });
//     console.log(mapper, "mapper");

//     console.log(storeState, "数据");

//     return storeState;
// }
// // useState
// export function useState(moduleName: string, mapper: Array<string>) {
//     console.log(moduleName, "moduleName");

//     let mapperFn = mapState;
//     if (typeof moduleName === "string" && moduleName.length > 0) {
//         mapperFn = createNamespacedHelpers(moduleName).mapState;
//     }
//     return useMapper(mapper, 'mapState', mapperFn);
// }
// // useGetters
// export function useGetters(moduleName: string, mapper: Array<string>) {
//     let mapperFn = mapGetters;
//     if (typeof moduleName === "string" && moduleName.length > 0) {
//         mapperFn = createNamespacedHelpers(moduleName).mapGetters;
//     }
//     return useMapper(mapper, 'mapGetters', mapperFn);
// }
// // useActions
// export function useActions(moduleName: string, mapper: Array<string>) {
//     let mapperFn = mapActions;
//     if (typeof moduleName === "string" && moduleName.length > 0) {
//         mapperFn = createNamespacedHelpers(moduleName).mapActions;
//     }
//     return useMapper(mapper, 'mapActions', mapperFn);
// }
// // useMutations
// export function useMutations(moduleName: string, mapper: Array<string>) {
//     let mapperFn = mapMutations;
//     if (typeof moduleName === "string" && moduleName.length > 0) {
//         mapperFn = createNamespacedHelpers(moduleName).mapMutations;
//     }
//     return useMapper(mapper, 'mapMutations', mapperFn);
// }
